<meta charset="utf-8"/>
<link rel="stylesheet" href="style/calendrier.css" type="text/css" media="screen" />

<script type="text/javascript" src="modeles/jquery.js"></script>
<script type ="text/javascript" src="modeles/javascriptFonctions.js"></script>
<script type ="text/javascript" src="modeles/calendrier.js"></script>

<h2>Fiche action</h2>

<?php
	if(isset($_SESSION["erreur"]))
	{
		foreach($_SESSION["erreur"] as $e)
		{
			echo $e."</br>";
		}
		unset($_SESSION["erreur"]);
	}
	echo '<br/>
	<form action="index.php?module=actionComm&amp;action=detail&amp;'.ID_ADC.'='.$_GET[ID_ADC].'&retour='.$_GET["retour"].'" method="post" >';
if($adc->get_groupableForum()==0)
{
	echo'<hr class="trait"/>
		<table id="tabTaches">
			<th><h4>Tâches</h4></th>
				<tr>
					<th class="BPlus">
					<input type="button" name="Plus" value="+" onClick="ajoutTache()"/>
					</th>
					<th>
						<label for="TacheRealise">Tâches réalisées</label>
					</th>
					<th>
						<label for="Echeance">Echéance</label>
					</th>
					<th>
						<label for="Responsable">Responsable</label>
					</th>
					<th></th>
				</tr>
				<tr id="tabTache">
					<td></td>
					<td class="TabT">
						<input type="text" name="TacheRealise[]" class="champ" onBlur="verifChamp(this)" onFocus="blanc(this)"/>
					</td>
					<td class=\'TabT\'>				
						<input size=20 type="text" name="Echeance[]" placeholder="jj/mm/aaaa" class="calendrier"/>
					</td>
					<td class=\'TabT\'>
						<div id=\'for\'>
						<select class="obligatoire" name="Responsable[]">';					
							foreach($adc->get_etudiants_ADC() as $etu)
							{
								echo '<option value="'.$etu->get_id().'">'.$etu->get_nom().' '.$etu->get_prenom().'</option>';
							}
							echo'</select>
						</div>
					</td>
					<td></td>
				</tr>
				<tr  id="ajoutTache">';
		 			if(isset($_POST["TacheRealise"])) // rajoute les champs si infos dedans
		 			{
		 				for($i=1;$i<count($_POST["TacheRealise"]);$i++)
						{
		 					if(isset($_POST["TacheRealise"][$i]) && (!empty($_POST["TacheRealise"][$i]) || !empty($_POST["Echeance"][$i]) || !empty($_POST["Responsable"][$i])))
		 					{
		 						echo '<script>javascript:ajoutTache("'.$_POST["TacheRealise"][$i].'","'.$_POST["Echeance"][$i].'","'.$_POST["Responsable"][$i].'")</script>';
		 					}
		 				}
		 			}	
					
		 		echo '</tr>
		 	<th colspan="5" class="trait3"><tr><tr/></th>	
		 	<th><h4>Dépenses</h4></th>
		 		<tr>
		 			<th class=\'BPlus\'>
						<input type="button" name="Plus" value="+" onClick="ajoutDepense()"/>
		 			</th>
		 			<th>
		 				<label for="NatureDepense">Nature</label>
		 			</th>
		 			<th>
		 				<label for="BudgetDepense">Budgets </label>
		 			</th>
		 			<th>
		 				<label for="Fournisseur">Fournisseur</label>
					</th>
					<th></th>
				</tr>
				<tr id="tabDepense">
					<td></td>
			 		<td>
						<input type="text" name="NatureDepense[]" class="obligatoire" onBlur="verifChamp(this)" onFocus="blanc(this)"/>
					</td>
					<td>
			 			<input type="text" name="BudgetDepense[]" class="obligatoire" onBlur="verifChamp(this)" onFocus="blanc(this)"/>
					</td>
			 		<td>
						<input type="text" name="Fournisseur[]" class="obligatoire"/>
			 		</td>
		 			<td class="BMoins">
						<input type="button" value="-" onClick="enleveLigne(this,\'tabTaches\')"/>
					</td>
		 		</tr>	
			 	<tr  id="ajoutDepense">
				</tr>
			<th colspan="5" class="trait3"><tr><tr/></th>	
			<th><h4>Recettes</h4></th>
				<tr>
		 			<th class="BPlus">
						<input type="button" name="Plus" value="+" onClick="ajoutRecette()"/>
		 			</th>
		 			<th>
		 				<label for="NatureRecette">Nature</label>
		 			</th>
		 			<th>
		 				<label for="BudgetsRecette">Budgets</label>
		 			</th>
		 		</tr>
		 		<tr id="tabRecette">
					<td></td>
					<td>
						<input type="text" name="NatureRecette[]" class="obligatoire" onBlur="verifChamp(this)" onFocus="blanc(this)"/>
					</td>
					<td>
						<input type="text" name="BudgetRecette[]" class="obligatoire" onBlur="verifChamp(this)" onFocus="blanc(this)"/>
				 	</td>
				 	<td></td>
				 	<td class="BMoins">
						<input type="button" value="-" onClick="enleveLigne(this,\'tabTaches\')"/>
		 			</td>
		 		</tr>
		 		<tr  id="ajoutRecette">
		 		</tr>		
		</table>
		
		<br/>
		<hr id="trait2"/>
		<table class="sansBord">
		 <tr>
			<th><h4>Points positifs</h4></th>
				<td>
					<textarea name="PointPositif" cols="100" rows="10"></textarea>
				</td>
		</tr>';
}
else 
{
	echo'<br/>
		<hr id="trait2"/>
		<table class="sansBord">
			<tr>
				<th><h4>Travail effectué</h4></th>
				<td>
					<textarea name="TravailEffectue" cols="100" rows="10"></textarea>
				</td>
			</tr>
			<tr>
				<th colspan="5" class="trait3"><tr><tr/></th>
				<th><h4>Points positifs</h4></th>
				<td>
					<textarea name="PointPositif" cols="100" rows="10"></textarea>
				</td>
			</tr>';
}
?>
	<tr>
		<th colspan="5" class="trait3"><tr><tr/></th>		
		<th><h4>Points négatifs</h4></th>
			<td>
				<textarea name="PointNegatif" cols="100" rows="10"></textarea>
			</td>
	</tr>
	<tr>
		<th colspan="5" class="trait3"><tr><tr/></th>		
		<th><h4>Bon à savoir</h4></th>
			<td>
				<textarea name="BonASavoir" cols="100" rows="10">Astuces, personnes ressources...</textarea>
			</td>
	</tr>
	<tr>
		<th colspan="5" class="trait3"><tr><tr/></th>		
		<th><h4>Suggestions</h4></th>
			<td>
				<textarea name="Suggestion" cols="100" rows="10"></textarea>
			</td>
			<td>
				<span id="erreur"></span>
			</td>
	</tr>		
</table>		
	<p>
		<input class="Ligne2" type="submit" value="Envoyer" name="envoyerFicheADC" onClick = "return verifFormulaire()"/>
		<input class="Ligne2" type="submit" value="Retour" name="retour"/>
		
	</p>
</form>